Template Builder allows you to parse command responses in your workflows using pre-built or custom templates. The application takes text input in the Console area and parses it in real-time against a template in the Template area. Template Builder returns the parsed results in the Response area as a data table. By parsing complex data that is normally verified by manual interaction, you have real-time information to make better decisions about your system.
Note: Itential Automation Platform (IAP) is compatible with several third-party software products for network operating environments. Beginning with the system requirements for 2019.1.2, all third-party software version compatibility is documented in Release Notes. To get the most up-to-date requirements for any third-party software, including open source, first identify which IAP release you are using and then refer to the respective release note.
Figure 1: Create New Template
Application Features
The Console and Template areas are parsed in real-time against your templates to give instant feedback about what is working and what is not.
Template Builder has over 200 ready-to-use templates based on the most common device commands. Use these templates to parse command responses in your workflows.
User Interface
This section provides a quick walk-through of the Template Builder interface.
Note: For information on how to import, export and delete Templates, see the Automation Studio Overview.
Figure 2: Main Template Builder View
Label | UI Element | Function |
---|---|---|
1 | View Collection | Overview of all templates with advanced features such as searching and import/export. |
2 | Navigation | A quick view of all available templates. Each template is divided into a custom group, usually based on the device type. You can click on any template to view it in the main canvas (right of left menu). |
3 | Name | Enter the name of your template. System templates use a combination of the template group and the command field for their name. |
4 | Group | Used to group your templates into collections. This allows you to easily find the most relevant templates you may later need. |
5 | Command | Allows you to specify the command the template should run against. |
6 | Template Type | Selects the parsing type. |
7 | Console | The Console area serves as a way to test your template against a typical text response you would expect. This text will be parsed by your template and the output will be displayed in the Response area below. Any text can be parsed by TextFSM. The most common use case is to parse CLI response text since it usually does not provide a system level response that can be parsed. |
8 | Template | The Template area contains the TextFSM template that will parse your console text. Use the prebuilt templates to modify the TextFSM template; you can also use it as a guide to write your own custom template. As you make modifications to the template, the Response area will update with the data object from TextFSM. |
9 | Response | Output from the template engine TextFSM is displayed in the Response area in the form of a data table. This response can be used in workflows in the form of an object. |
TextFSM
TextFSM can be difficult to understand at first but if you use existing templates as your guide, you can become more familiar with how they work. With the real-time TextFSM engine, you can see how your response is updated when the Template or Console text is modified. You can copy/paste example templates into Template Builder and modify the value/state definitions to create a custom file.
Note: For more detailed information on TextFSM, refer to following wiki on GitHub: Google TextFSM Wiki.
Jinja2
Jinja2 is a widely known templating engine for Python, and Template Builder is designed to render Jinja2 templates for parsing command outputs into JSON objects to be utilized in workflows. Of note, values passed to a Jinja2 template are within the data object. Moreover, there is a workflow task to render Jinja2 templates from within workflows.
The renderJinjaTemplate
task generates output from a template file in the templates folder of app-template_builder
.
Note: For more information on Jinja2, refer to the following links:
Referenced below are two simple examples of Jinja2 templates. The first example template uses variables, and the second one uses an iteration.
Figure 3: Jinja2 Variables Template
Figure 4: Jinja2 Iteration Template